<? $tietol='Đặt sân'; ?>
<? include("thong_baotop.php"); ?>
<style>
.show_info{
	font-size:12px;
	position:relative;
	text-align:center;
	width:400px;
	color:#000;
}

.tbl_form_order td
{
	font-weight:bold;
}
</style>

<form method="post" onSubmit="return order_ground()" id='formGroundOrder'>
<table cellpadding="5" cellspacing="0" width="100%" border="0" class='tbl_form_order' >
	<tr>
    	<td>
        	Số điện thoại (*)
        </td>
        <td>
        	<input type='text' name='txt_telephone' class='txt_order' id='txt_telephone' value='' /> 
        </td>
    </tr>
	<tr>
    	<td>
        	Họ và tên
        </td>
        <td>
        	<input type='text' name='txt_name' class='txt_order' id='txt_name' value='' /> 
        </td>
    </tr>
    <tr>
    	<td>
        	Email
        </td>
        <td>
        	<input type='text' name='txt_email' class='txt_order' id='txt_email' value='' /> 
        </td>
    </tr>
    <tr>
    	<td>Tiện ích khác </td>
        <td>
        <?php
			foreach ($facilities as $facility)
			{
		?>
        	<div style='display:block;padding:5px 0;'>
            	<div style='float:left'>
	            	<input type='checkbox' name='order_facility_<?php echo $facility['id'] ?>' id='order_facility_<?php echo $facility['id'] ?>' /> 
                </div>
                <div style='float:left; padding-top:3px; padding-left:3px; '>
                	<label for="order_facility_<?php echo $facility['id'] ?>">
	                	<?php echo $facility['name'] ?> - <span style="color:#c00;"><?php echo $facility['value'] ?> VNĐ</span>
                    </label>
                </div>
                <div style='clear:both'></div>
            </div>
        <?
			}
		?>
        </td>
    </tr>
    <tr>
    	<td>
        	<input type='hidden' name='order_ground_id' id='order_ground_id' value='<?php echo $ground_id?>'>
            <input type='hidden' name='order_schedule' id='order_schedule' value='<?php echo $schedule?>'>
            <input type='hidden' name='order_date' id='order_date' value='<?php echo $date?>'>
            <div id='notify' style='font-weight:bold;color:#c00;'></div>
        </td>
        <td><input type='submit' class='btn_order' value='Đặt sân' /></td>
    </tr>
</table>
</form>

<script>
	function order_ground()
	{
		var txt_telephone = $.trim($("#txt_telephone").val());
		var txt_name = $.trim($("#txt_name").val());
		var txt_email = $.trim($("#txt_email").val());

		if (txt_telephone == "")
		{
			$("#notify").html("Xin vui lòng điền số điện thoại !");
			return false;
		}
		
		var ground_id = $("#order_ground_id").val();
		var date = $("#order_date").val();
		var schedule = $("#order_schedule").val();
		
		var url = "/web/frontend.php/ajax/order.html";
		$.ajax({
			url: url,
			type: 'POST',
			data: 'ground_id=' + ground_id + '&schedule=' + schedule + '&date=' + date + "&telephone=" + encodeURIComponent(txt_telephone) + "&name=" + encodeURIComponent(txt_name) + "&email=" + encodeURIComponent(txt_email),
			dataType: "html",
			success: function(data){
				showResult("luu_result",data);
			}
		});
		return false;
	}
</script>
<? include("thong_baobutton.php"); ?>